import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn } from 'typeorm';
import { IsNotEmpty } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
@Entity()
export class Recharge {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ comment: '用户id', default: '-' })
  @ApiProperty({ description: '用户id', example: 1 })
  userId: string;

  @Column('double', { comment: '充值前余额', default: 0 })
  @ApiProperty({ description: '充值前余额', example: 1 })
  last: number;

  @Column('double', { comment: '金额' })
  @ApiProperty({ description: '金额', example: 1 })
  @IsNotEmpty({ message: '金额不能为空' })
  money: number;

  @Column('double', { comment: '充值后余额', default: 0 })
  @ApiProperty({ description: '充值后余额', example: 1 })
  afterMoney: number;

  @CreateDateColumn({
    type: 'timestamp',
    nullable: false,
    name: 'create_time',
    comment: '创建时间',
  })
  create_time: Date;

  @UpdateDateColumn({
    type: 'timestamp',
    nullable: false,
    name: 'update_time',
    comment: '更新时间',
  })
  update_time: string;
}
